import request from '../utils/request.js'

// 用户登陆
export const loginApi = (data) => {
  return request.post('/login', data)
}
// 获取侧边栏
export const menusApi = () => {
  return request.get('/menus')
}

// 获取用户列表
export const usersApi = (data) => {
  return request.get('/users', {
    params: data
  })
}

// 添加用户
export const addusersApi = (data) => {
  return request.post('/users', data)
}

// 删除用户
export const delusersApi = (id) => {
  return request.delete(`/users/${id}`)
}

// 编辑用户
export const editusersApi = (id, data) => {
  return request.put(`/users/${id}`, {
    email: data.email,
    mobile: data.mobile
  })
}

// 修改用户详情,滑块
export const edithuakuaiApi = (id, bool) => {
  return request.put(`/users/${id}/state/${bool}`)
}

// 分配角色权限
export const fenpeiUser = (id, rid) => {
  return request.put(`/users/${id}/role`, {
    rid: rid
  })
}
